*&---------------------------------------------------------------------*
*& Report ZEX_LISTING_52                                               *
*&---------------------------------------------------------------------*
*& Created By: James Wood (james.wood@bowdarkconsulting.com)           *
*& Created On: 12/12/2008                                              *
*& Purpose:    This program demonstrates the use of the PROTECTED      *
*&             visibility section.                                     *
*&---------------------------------------------------------------------*
REPORT zex_listing_52.

*----------------------------------------------------------------------*
*       CLASS lcl_employee DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_employee DEFINITION.

  PROTECTED SECTION.
    DATA: id TYPE numc10,
    hire_date TYPE sydatum.

ENDCLASS.                    "lcl_employee DEFINITION

*----------------------------------------------------------------------*
*       CLASS lcl_hourly_employee  DEFINITIO
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_hourly_employee DEFINITION
      INHERITING FROM lcl_employee.

  PUBLIC SECTION.
    METHODS:
      constructor IMPORTING im_id TYPE numc10
                            im_hire_date TYPE sydatum,
      display.

ENDCLASS.                    "lcl_hourly_employee  DEFINITIO

*----------------------------------------------------------------------*
*       CLASS lcl_hourly_employee IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_hourly_employee IMPLEMENTATION.
  METHOD constructor.
*   Must call the constructor of the superclass first:
    CALL METHOD super->constructor( ).

*   Initialize the instance attributes;
*   Notice that we can access these attributes directly:
    id = im_id.
    hire_date = im_hire_date.
  ENDMETHOD. "constructor

  METHOD display.
    WRITE: / 'Employee #', id,
             'was hired on', hire_date.
  ENDMETHOD. "display
ENDCLASS.                    "lcl_hourly_employee IMPLEMENTATION

*----------------------------------------------------------------------*
* START-OF-SELECTION Event Module                                      *
*----------------------------------------------------------------------*
START-OF-SELECTION.
  PERFORM test_employee.

FORM test_employee.

* Local Data Declarations:
  DATA: lr_employee TYPE REF TO lcl_hourly_employee.

* Create an employee and display it:
  CREATE OBJECT lr_employee
    EXPORTING
      im_id        = '1234567890'
      im_hire_date = '20030113'.

  lr_employee->display( ).

ENDFORM.